package com.food.controller;


import com.food.configure.Result;
import com.food.entity.Order;
import com.food.service.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author
 * @since 2021-04-04
 */
@RestController
@RequestMapping("/order")
public class OrderController {

    @Autowired
    OrderService orderService;

    /**
     * 添加/修改
     */
    @RequestMapping("/updateOrder")
    public Result<Order> updateOrder(@RequestBody Order order) {
        return orderService.updateOrder(order);
    }

    /**
     * 删除
     */
    @RequestMapping("/delOrder")
    public Result<Order> delOrder(@RequestBody Order order) {
        return orderService.delOrder(order);
    }

    /**
     * 批量删除
     */
    @RequestMapping("/batchDelOrder")
    public Result<Order> batchDelOrder(@RequestBody Order order) {
        return orderService.batchDelOrder(order);
    }

    /**
     * 查询(不分页)
     */
    @RequestMapping("/queryOrder")
    public Result<Order> queryOrder(@RequestBody Order order) {
        return orderService.queryOrder(order);
    }

    /**
     * 查询(分页)
     */
    @RequestMapping("/queryOrderByPage")
    public Result<Order> queryOrderByPage(@RequestBody Order order) {
        return orderService.queryOrderByPage(order);
    }

    /**
     * 根据ID查询
     */
    @RequestMapping("/queryOrderById")
    public Result<Order> queryOrderById(@RequestBody Order order) {
        return orderService.queryOrderById(order);
    }

}

